package com.aco.party.web.validator.system;

import com.aco.party.web.command.system.EditQuestionCommand;
import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

/**
* Created by flying on 3/10/2016 0010.
*/
public class EditSimpleInputValidator implements Validator {
@Override
public boolean supports(Class<?> aClass) {
return EditQuestionCommand.class.isAssignableFrom(aClass);
}

@Override
public void validate(Object o, Errors errors) {
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "title", "error.title.empty", "标题不能为空");
    ValidationUtils.rejectIfEmptyOrWhitespace(errors, "content", "error.content.empty", "内容不能为空");
}
}
